% SUBSYSTEM DESCRIPTION: system_2.m

function  [xdot,y] = system_2(x,u,t)
ha=0.065;
he=0.085;

xdot = 0;

global xhyst;

if xhyst== 1             %falls Start bei 1
    if u(1) < -1*he
        xhyst = -1;
    elseif u(1) < ha
        xhyst = 0;
    else
        xhyst = 1;
    end;
elseif xhyst== 0             %falls Start bei 0
    if u(1) < -1*he
        xhyst = -1;
    elseif u(1) > he
        xhyst = 1;
    else
        xhyst = 0;
    end;
elseif xhyst== -1             %falls Start bei -1
    if u(1) > he
        xhyst = 1;
    elseif u(1) > -1*ha
        xhyst = 0;
    else
        xhyst = -1;
    end;

end;    

% output equation    
y(1) = xhyst;

    
